<?php
/**
 * Created by PhpStorm.
 * User: coffee
 * Date: 2017/12/29
 * Time: 下午2:07
 */

$app->group(['prefix' => '/s/events', 'middleware' => ['oauth.scopes:student', 'oauth.consumer:student']], function () use ($app) {
    // 台历活动
    $app->post('/calendarPresent', [
        'uses' => 'StudentEventsController@createStudentCalendarPresentEvent'
    ]);
    $app->get('/calendarPresent', [
        'uses' => 'StudentEventsController@retrieveStudentCalendarPresentEvent'
    ]);

    // 拼读分享活动
    $app->group(['prefix' => '/phonics'], function () use ($app) {

        $app->post('/share', [
            'uses' => 'PhonicsShareController@create'
        ]);

        $app->get('/withdraw/summary', [
            'uses' => 'PhonicsWithdrawController@retrieveSummary'
        ]);

        $app->post('/withdraw', [
            'uses' => 'PhonicsWithdrawController@create'
        ]);

        $app->get('/withdraw/history', [
            'uses' => 'PhonicsWithdrawController@retrieveHistory'
        ]);
    });

    // 赠1得2活动
    $app->group(['prefix' => '/giftLesson'], function () use ($app) {
        $app->get('/', [
            'uses' => 'GiftLessonShareController@retrieve'
        ]);

        $app->post('/accept', [
            'uses' => 'GiftLessonAcceptanceController@accept'
        ]);
    });

    // 数据统计
    $app->post('/actions', [
        'uses' => 'StudentActionsStatisticsController@create'
    ]);

    // 抢福袋活动
    $app->group(['prefix' => '/luckyBags'], function () use ($app) {
        $app->get('/', [
            'uses' => 'LuckyBagController@retrieve'
        ]);

        $app->put('/grab', [
            'uses' => 'LuckyBagController@grabLuckyBag'
        ]);
    });

    // 抢福袋活动
    $app->group(['prefix' => '/inviteOneOnOne'], function () use ($app) {
        $app->get('/', [
            'uses' => 'InviteOneOnOneController@retrieve'
        ]);

        $app->get('/code', [
            'uses' => 'InviteOneOnOneController@retrieveByShareCode'
        ]);
    });
});